//
//  BQHomeButtonView.m
//  BeeQuick
//
//  Created by mac on 16/11/21.
//  Copyright © 2016年 six_group. All rights reserved.
//

#import "BQHomeButtonView.h"
#import <UIImageView+WebCache.h>

@interface BQHomeButtonView()

@property(nonatomic,weak)UIImageView *iconView;

@property(strong,nonatomic)UILabel *titleLabel;


@end
@implementation BQHomeButtonView

- (instancetype)init
{
    if(self = [super init])
    {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    self.backgroundColor = [UIColor cz_colorWithHex:0xffffff];
    
    UIImageView *iconView = [[UIImageView alloc]init];
    
    [self addSubview:iconView];
    
    self.iconView = iconView;
    
    UILabel *titleLabel = [[UILabel alloc]init];
    
    [self addSubview:titleLabel];
    
    self.titleLabel = titleLabel;
    
    
    //设置字体大小
    self.titleLabel.font = [UIFont systemFontOfSize:12.5];
    
//   self.titleLabel.font = [UIFont boldSystemFontOfSize:12.5];

    //MARK: - 设置约束.
    
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self);
        make.size.mas_equalTo(CGSizeMake(69, 47));
        make.top.equalTo(self).offset(10);
        
    }];

    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(iconView.mas_bottom).offset(5);
        make.centerX.equalTo(self);
    }];
    
    
}

- (void)setModel:(BQActivityModel *)model
{
    _model = model;
    
    
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.img]];
    
    
    self.titleLabel.text = model.name;
    
    
}


- (void)setTitle:(NSString *)title
{
    _title = title;
    
    
    self.titleLabel.text = title;
}


- (void)setImg:(NSString *)img
{
    _img = img;
    
    self.iconView.image = [UIImage imageNamed:img];
}
@end
